const EventEmitter = rquire("events").EventEmitter;

function Dog(dogName){
    /**
     * function.call会执行一次Function函数
     * 并且函数执行的上下文是当前的Dog构造函数实例化的对象
     */
    EventEmitter.call(this);
    this.dogName = dogName;
    setTimeout(()=>{
        this.emit("bark");
    },3000)
}
Dog.prototype = EventEmitter.prototype;
let dog = new Dog("zangao");

dog.dogName("bark",()=>{
    console.log("dog is barking");
})